package com.srwl.mytx.contrack;

import com.srwl.mytx.BasePresenter;
import com.srwl.mytx.BaseView;
import com.srwl.mytx.domain.Topic;

import java.util.List;
import java.util.Map;

/**
 * Created by dahai2070 on 2018/2/26 0026.
 */

public interface GoodsConstrack {
   int GOODS_STATUS_NORMAL = 1;// 上架中
    Integer GOODS_STATUS_BACKOUT = 0;//下架中
    enum QueryType{ GET_DATE_FLAG_LOAD_MORE,GET_DATE_FLAG_REFRESH}
    interface  View extends BaseView<Presenter>{
        void showToast(String message);
        void showProgressDialog(String message);
        void disMissProgressDialog();

        /**
         *
         * @param goodsList
         * @param queryType  查询类型标记：刷新数据（查询第一页）、获取更多数据（查询下一页）
         * @param total 可返回数据总条数
         */
       void notifyDateChange(List<Topic> goodsList, QueryType queryType, int total);
       void onBackOutComplete(Topic targetGoods);
       void onSetOnLineComplete(Topic targetGoods);
       void onUpdateComplete(Topic targetGoods);
       void onDeleteComplete(Topic targetGoods);
       void onRefreshComplete(Topic targetGoods);
    }

    interface Presenter extends BasePresenter{
        /**
         * 下架 更改status 值为 0
         * @param targetGoods
         */
        void backOut(Topic targetGoods, String goodsId);

        /**
         * 上线 更改status 值为 1
         * @param targetGoods
         */
        void onLine(Topic targetGoods, String goodsId);

        /**
         * 更具用户名和status 值获取数据
         * @param info 包含uid  和 status 两个值
         */
        void searchByUid(Map<String, Object> info, QueryType queryType);

        /**
         * 刷新：刷新uodate_date 为当前时间点
         * @param targetGoods
         */
        void refresh(Topic targetGoods, String goodsId);

        /**
         * 更新：改变内容 标题等
         * @param targetGoods
         */
        void update(Topic targetGoods, String goodsId);


        void delete(Topic targetGoods, String goodsId);
    }

}
